feat: sync CLAUDE.md to all standalone plugin repos#2
Merged
Conversation
Add a template and generator script that produces a consistent CLAUDE.md for each plugin repo during the existing sync workflow. The template includes plugin-specific components (agents, skills, commands) plus universal critical rules, model selection, and core priorities. - templates/CLAUDE.md.tmpl: Mustache-style template with conditionals - scripts/generate-claudemd.js: Zero-dependency renderer - scripts/generate-claudemd.test.js: 6 tests covering all shapes - .github/workflows/sync.yml: Add CLAUDE.md generation step, web-ctl
…hardening
- Validate CLI args (reject missing values, non-flag tokens)
- Add try/catch around writeFileSync
- Fix TOCTOU in components.json reading
- Make conditional block trailing newline optional in regex
- Use String() for items and global replace for {{items}}
- Workflow: use git status --porcelain for untracked file detection
- Workflow: add fail-fast: false, permissions block, --base main
- Workflow: use env var for matrix.repo, include repo name in branch
- Template: add auto-generated comment
- Tests: add error-path tests (missing target, missing package.json,
malformed components.json, stdout verification)
…ll safety
- Escape {{ and }} in component items to prevent template injection
- Add explicit bounds check in parseArgs for odd arg count
- Use env vars instead of inline matrix interpolation in shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
templates/CLAUDE.md.tmplwith conditional sections for agents, skills, commands plus universal critical rulesscripts/generate-claudemd.js) that readspackage.json+components.jsonto render plugin-specific CLAUDE.mdsync.ymlworkflow to generate and sync CLAUDE.md alongsidelib/to all 14 consumer reposfail-fast: false,git status --porcelainfor untracked files, env vars for shell safety,--base mainTest Plan
node --test scripts/generate-claudemd.test.js)Related Issues
Closes agent-sh/.github#2